package cn.controller;

import cn.service.MybatisService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class MainController {

    //获取Logger实体类
    private static Logger logger=Logger.getLogger(MainController.class);

    //由spring自动注入
    @Autowired
    private MybatisService mybatisService;

    @RequestMapping(value = "test", method = RequestMethod.GET)
    public String test() {

         /**
         测试Debug、Info、Error三个级别的日志:
         logger.debug("It'a a debug test");
         logger.info("It's a info test");
         logger.error("It's a error test");
         */
        return "test";
    }

    @RequestMapping(value = "springtest", method = RequestMethod.GET)
    public String springTest() {
        return mybatisService.test();
    }
}
